%h5.gl-heading-4= _('Repository cleanup')
%p.gl-text-subtle
  - link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe
  - git_filter_link_start = link_start % { url: 'https://github.com/newren/git-filter-repo' }
  - link_end = '</a>'.html_safe
  - help_link_title = _('What happens during repository cleanup?')
  = _("Upload a text file of objects, and then GitLab removes internal Git references to these objects. Use %{git_filter_link_start}git filter-repo%{git_filter_link_end} on the repository to generate the list of objects to remove as a commit-map file.").html_safe % { git_filter_link_start: git_filter_link_start, git_filter_link_end: link_end }
  = link_to sprite_icon('question-o'),
    help_page_path('user/project/repository/repository_size.md',
    anchor: 'clean-up-repository'),
    title: help_link_title,
    aria: { label: help_link_title },
    target: '_blank',
    rel: 'noopener noreferrer'

- url = cleanup_namespace_project_settings_repository_path(@project.namespace, @project)
= gitlab_ui_form_for @project, url: url, method: :post, authenticity_token: true do |f|
  %fieldset.gl-mt-0.gl-mb-3
    .gl-mb-3
      %h6.gl-mt-0
        = _("Upload commit-map file")
      = render Pajamas::ButtonComponent.new(button_options: { class: 'js-choose-file' }) do
        = _("Choose a file")
      %span.gl-ml-3.js-filename
        = _("No file selected")
      = f.file_field :bfg_object_map, class: "hidden js-object-map-input", required: true
    .form-text.gl-text-subtle
      = _("The maximum file size is %{size}.") % { size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes) }

  = f.submit _('Start cleanup'), pajamas_button: true
